package com.sali.b_design_pattern.f_responsibility_pattern.strategy.method02.handler;

import com.sali.b_design_pattern.f_responsibility_pattern.strategy.method02.pojo.entity.Result;
import com.sali.b_design_pattern.f_responsibility_pattern.strategy.method02.pojo.vo.ProductVO;

/**
 * 处理器链路的客户端
 *
 * @author sali
 * @date 2025/3/16 10:09
 */
public class HandlerClient {

    public static Result executeChain(AbstractCheckHandler handler, ProductVO param) {
        // 执行处理器
        Result handlerResult = handler.handle(param);
        if (!handlerResult.isSuccess()) {
            System.out.println("HandlerClient 责任链执行失败返回：" + handlerResult.toString());
            return handlerResult;
        }
        return Result.success();
    }

}
